<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <child1>
            <p>德玛西亚</p>
        </child1>
        <child2>
            <template #dmxy>
                德玛西亚
            </template>
           <template #default>
               <div>
                   这是一个div
               </div>
           </template>
            <template v-slot:nkss>
                诺克萨斯
            </template>
        </child2>

        <child3>
            <template v-slot="{a, b}"> 
                <div>
                    这是child3的内容
                    {{a}} {{b}}
                </div>
            </template>
        </child3>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        const child1 = {
            template: `
                <div>
                    <slot></slot> // 匿名插槽
                </div>
            `
        }

        const child2 = {
            template: `
                <div>
                    <slot name="dmxy"></slot> // 具名插槽
                    <hr />
                    <slot></slot>
                    <slot name="nkss"></slot>
                </div>
            `
        }
        const child3 = {
            // 作用域插槽
            template: `
                <div>
                    <slot v-bind:a="123" b="德玛西亚"></slot>
                </div>
            `
        }
        new Vue({
            el: "#app",
            components: {
                child1,
                child2,
                child3
            },
            data: {

            }
        })
    </script>
</body>
</html>